<?php
use think\migration\Migrator;
use think\migration\db\Column;

class CreateMarketingVideoImage2videoTasks extends Migrator
{
    public function change()
    {
        $this->table('marketing_video_image2video_tasks', ['engine' => 'InnoDB'])
            ->addColumn('task_id', 'string', ['limit' => 64, 'comment' => '远程任务ID'])
            ->addColumn('product_replace_result_key', 'string', ['limit' => 64, 'comment' => '图片替换结果key'])
            ->addColumn('mode', 'string', ['limit' => 10, 'comment' => '视频模式：lite/pro'])
            ->addColumn('image2video_prompt', 'text', ['null' => true, 'comment' => '视频生成提示'])
            ->addColumn('voiceover_id', 'string', ['limit' => 64, 'comment' => '配音ID'])
            ->addColumn('tts_text', 'text', ['null' => true, 'comment' => '配音文本'])
            ->addColumn('status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '状态：0待处理,1处理中,2已完成,3失败'])
            ->addColumn('preview_video_url', 'string', ['limit' => 255, 'null' => true, 'comment' => '预览视频URL'])
            ->addColumn('finished_video_url', 'string', ['limit' => 255, 'null' => true, 'comment' => '完成视频URL'])
            ->addColumn('error_msg', 'string', ['limit' => 255, 'null' => true, 'comment' => '错误信息'])
            ->addColumn('user_id', 'integer', ['comment' => '创建者用户ID'])
            ->addColumn('create_time', 'timestamp', ['default' => 'CURRENT_TIMESTAMP'])
            ->addIndex(['task_id'], ['unique' => true])
            ->create();
    }
} 